// LemCoop
// Copyright (C) 2013  Oliver Naumann <bldrax@gmail.com>

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#ifndef LEMC_LEVELLOADER_H
#define LEMC_LEVELLOADER_H

#include <string>
#include <fstream>
#include <rapidxml.hpp>
#include <boost\lexical_cast.hpp>

#include "../resourcemanager/allegro_bitmap_manager.h"
#include "groundmask.h"
#include "../util/logmanager.h"
#include "level.h"
#include "../system/global.h"

class Level;

/*
* This class is merely used to load a level. It will not be used for anything else.The LevelLoader is supposed to
* be created by the level. It will then load everything from the level files and pass the information back to
* the level so that it can run.
*/
class LevelLoader
{
private:
	// The pointer to the level where everything will be stored in the end.
	Level* m_level;

public:
	/*
	* The contructor merely sets the pointer back to the level.
	*
	* @param level The pointer to the level.
	*/
	LevelLoader(Level* level);

	/*
	* This function loads a level from xml data. It afterwards passes every information read from the xml to
	* the level.
	* TODO: This essentially doesn't have any error handling yet.
	*
	* @param xml_data The xml data that contains the level.
	*
	* @return True if the level was loaded successfully, false else.
	*/
	bool LoadLevel(std::string xml_data);
};

#endif